Skip to content

Conversation

pfefferle
Copy link
Member

@pfefferle pfefferle commented Aug 4, 2025

Fixes #2099.

This PR implements a self-destruct feature for ActivityPub that allows users to remove their blog from the Fediverse by sending Delete activities to all followers. The implementation includes a CLI command, completion tracking, and admin notifications.

Screenshot 2025-08-06 at 12 35 39

Proposed changes:

  • Implements the wp activitypub self_destruct CLI command with confirmation prompts and progress tracking
  • Adds completion detection logic that monitors for pending Delete activities and notifies when the process finishes
  • Provides admin notice functionality to inform users when the self-destruct process is complete

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Run wp activitypub self_destruct in the CLI
  • Check the Outbox for Delete Activities

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

Adds a self-destruct feature to remove a blog from the Fediverse by sending Delete activities to followers.

Improves the self_destruct method to schedule deletion for all users with the 'activitypub' capability, logs each scheduled user, and updates messaging for clarity. Adds an option to mark the deletion process and instructs users to keep the plugin active until completion.
Enhanced the self_destruct command to provide clearer warnings, detailed process steps, and progress feedback when deleting a blog from the Fediverse. Added checks for user existence, improved error handling, and clarified next steps for users after scheduling deletions.
@pfefferle pfefferle added this to the User Delete milestone Aug 6, 2025
Implements a mechanism to check when all Delete activities for ActivityPub self-destruct are processed, removes the self-destruct flag, and displays an admin notice upon completion. Enhances user feedback and ensures proper cleanup after self-destruct operations.
@pfefferle pfefferle marked this pull request as ready for review August 6, 2025 11:12
@Copilot Copilot AI review requested due to automatic review settings August 6, 2025 11:12
Copilot

This comment was marked as outdated.

pfefferle and others added 2 commits August 6, 2025 13:15
Changed the action hook from 'activitypub_self_destruct_processing_complete' to 'activitypub_outbox_processing_complete' and updated the method signature for check_self_destruct_completion to accept only inboxes and JSON. Adjusted post type, status, and meta key in the pending deletes query for consistency with Outbox implementation.
@pfefferle pfefferle self-assigned this Aug 6, 2025
@pfefferle pfefferle requested review from obenland and Copilot August 6, 2025 11:25
Copilot

This comment was marked as outdated.

Replaces direct parameters with an Activity object when adding a 'Delete' activity to the outbox. This change improves consistency and leverages the Activity class for better structure.
The self_destruct WP-CLI command for ActivityPub is now refactored for modularity and clarity, with improved documentation, confirmation handling, and status checking. The process is split into smaller private methods, and a new --status flag allows users to check progress. The self-destruct completion logic and related hook are removed from Scheduler, and status tracking is now handled directly in the CLI command.
Standardized inline comments by adding missing periods for consistency and improved readability in class-cli.php.
@pfefferle pfefferle requested review from obenland and Copilot August 26, 2025 18:00
Copilot

This comment was marked as outdated.

@obenland
Copy link
Member

%  wp activitypub self_destruct --status

🔍 Self-Destruct Status Check

⏳ Status: IN PROGRESS
The self-destruct process is currently running.

📊 Progress: 1 Delete Activities still pending

💡 Note: The process may take several minutes to complete.

AI sure loves their emoji

@pfefferle
Copy link
Member Author

not good?

@obenland
Copy link
Member

I don't care too much but others might. Having one on every line arguably makes their effects moot.

pfefferle and others added 4 commits August 26, 2025 21:12
Co-authored-by: Konstantin Obenland <[email protected]>
Co-authored-by: Konstantin Obenland <[email protected]>
Adjusted the alignment of 'key' and 'value' in the meta_query array for better code readability and consistency.
Emojis were removed from the progress and note messages in the self-destruct process output to improve compatibility and readability in CLI environments.
@pfefferle pfefferle requested a review from Copilot August 26, 2025 19:21
Copilot

This comment was marked as outdated.

Consolidated and reformatted the message shown when the self-destruct process has not started, making the command to run more visible and easier to follow.
Replaces the import of Followers with Outbox in the class-cli.php file to ensure correct class usage.
@pfefferle pfefferle requested review from obenland and Copilot August 27, 2025 06:35
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a self-destruct feature for ActivityPub that allows users to completely remove their blog from the Fediverse by sending Delete activities to all followers. This is an irreversible operation designed to provide a clean exit mechanism from ActivityPub networks.

  • Adds a comprehensive CLI command wp activitypub self_destruct with confirmation prompts, status checking, and progress tracking
  • Implements completion detection that monitors pending Delete activities and provides admin notifications when the process finishes
  • Provides user-friendly feedback and safety measures including warnings, confirmation prompts, and status monitoring

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
includes/class-cli.php Implements the main self-destruct CLI command with user confirmation, progress tracking, and status checking functionality
includes/wp-admin/class-admin.php Adds admin notice display for self-destruct completion notifications
.github/changelog/2046-from-description Adds changelog entry for the new self-destruct feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@pfefferle pfefferle merged commit 6984d23 into trunk Aug 27, 2025
15 checks passed
@pfefferle pfefferle deleted the add/self-destruct branch August 27, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separate Instance Actor and Blog Profile for Delete Actor Implementation
3 participants